namespace OFX.Aggregator.Infrastructure
{
	using System;
	using System.Diagnostics;

	public sealed class StatementSourceTemplate
	{
		[DebuggerBrowsable(DebuggerBrowsableState.Never)] private readonly string id;
		[DebuggerBrowsable(DebuggerBrowsableState.Never)] private readonly IStatementInterpreter interpreter;
		[DebuggerBrowsable(DebuggerBrowsableState.Never)] private readonly IStatementOfxConverter ofxConverter;
		[DebuggerBrowsable(DebuggerBrowsableState.Never)] private readonly IStatementProcessor postprocessor;
		[DebuggerBrowsable(DebuggerBrowsableState.Never)] private readonly IStatementRetrieval retrieval;

		[DebuggerBrowsable(DebuggerBrowsableState.Never)] private readonly IStatementSerializer serializer;

		public StatementSourceTemplate(string id, IStatementRetrieval retrieval, IStatementInterpreter interpreter, IStatementProcessor postprocessor, IStatementSerializer serializer, IStatementOfxConverter ofxConverter)
		{
			this.id = id;
			this.retrieval = retrieval;
			this.interpreter = interpreter;
			this.postprocessor = postprocessor;
			this.serializer = serializer;
			this.ofxConverter = ofxConverter;

			TransactionListingLag = new TimeSpan(1, 0, 0, 0);
		}

		public string Id
		{
			[DebuggerStepThrough]
			get { return this.id; }
		}

		public IStatementRetrieval Retrieval
		{
			[DebuggerStepThrough]
			get { return this.retrieval; }
		}

		public IStatementInterpreter Interpreter
		{
			[DebuggerStepThrough]
			get { return this.interpreter; }
		}

		public IStatementProcessor Postprocessor
		{
			[DebuggerStepThrough]
			get { return this.postprocessor; }
		}

		public IStatementSerializer Serializer
		{
			[DebuggerStepThrough]
			get { return this.serializer; }
		}

		public IStatementOfxConverter OfxConverter
		{
			[DebuggerStepThrough]
			get { return this.ofxConverter; }
		}

		public string AccountSetupPanelId { get; set; }
		public string DisplayName { get; set; }

		public TimeSpan TransactionListingLag { get; set; }

		public double TransactionListingLagInDays
		{
			get { return TransactionListingLag.Days; }
			set { TransactionListingLag = TimeSpan.FromDays(value); }
		}
	}
}